<template>
  <el-table :data="list" style="width: 100%;padding-top: 15px;">
    <el-table-column label="Order_No" min-width="200">
      <template slot-scope="scope">
        {{ scope.row.order_no | orderNoFilter }}
      </template>
    </el-table-column>
    <el-table-column label="Price" width="195" align="center">
      <template slot-scope="scope">
        ¥{{ scope.row.price | toThousandFilter }}
      </template>
    </el-table-column>
    <el-table-column label="Status" width="100" align="center">
      <template slot-scope="{row}">
        <el-tag :type="row.status | statusFilter">
          {{ row.status }}
        </el-tag>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>

  export default {
    filters: {
      statusFilter(status) {
        const statusMap = {
          success: 'success',
          pending: 'danger'
        }
        return statusMap[status]
      },
      orderNoFilter(str) {
        return str.substring(0, 30)
      }
    },
    data() {
      return {
        list: [
          {
            order_no: 'ffdA8EBB-5E26-dAF2-cBCe-2118ABB9FFE0',
            price: 5850.34,
            status: 'pending',
            timestamp: 600980663236,
            username: 'Frank White'
          },
          {
            order_no: 'f679cd1D-3121-d2dA-56C5-1173CbD1CDAc',
            price: 10668.2,
            status: 'pending',
            timestamp: 600980663236,
            username: 'Jose Williams'
          },
          {
            order_no: 'ceD31ce6-7cFc-fEBF-fc3B-09bfb9D07CDB',
            price: 9863.5,
            status: 'success',
            timestamp: 600980663236,
            username: 'Jessica Martinez'
          },
          {
            order_no: 'b15AC489-db46-A44A-FC71-9EBFb4fE7dAe',
            price: 3974.9,
            status: 'pending',
            timestamp: 600980663236,
            username: 'George Taylor'
          },
          {
            order_no: 'EcF921B1-aEFC-7EaC-Ab39-EFF1EF5bC7BF',
            price: 3367,
            status: 'pending',
            timestamp: 600980663236,
            username: 'Nancy Thompson'
          },
          {
            order_no: 'eB8DbEd2-67B2-fD4b-5176-Fb4D72482Aab',
            price: 12607,
            status: 'success',
            timestamp: 600980663236,
            username: 'Patricia Clark'
          },
          {
            order_no: 'AA165c69-a8EA-3C65-F6B5-96705Faf9fD9',
            price: 6606.33,
            status: 'success',
            timestamp: 600980663236,
            username: 'Frank Perez'
          },
          {
            order_no: 'ff5Dc2Cf-81d9-cafB-4A8c-68Cc8E5bAdA9',
            price: 13769,
            status: 'success',
            timestamp: 600980663236,
            username: 'Matthew Lopez'
          }
        ]
      }
    },
    created() {
      this.fetchData()
    },
    methods: {
      fetchData() {
      }
    }
  }
</script>
